package com.gec.zhs.entity.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gec.zhs.entity.enums.DateTimePatternEnum;
import com.gec.zhs.utils.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;


/**
 * @author zhs
 * @version 1.0
 * @date 2025-01-06
 * @description  视频播放历史
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class VideoPlayHistory implements Serializable {


    /**
     * 用户ID
     */
    private String userId;

    /**
     * 视频ID
     */
    private String videoId;

    /**
     * 文件索引
     */
    private Integer fileIndex;

    /**
     * 最后更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastUpdateTime;


    /**
     * 视频封面
     */
    private String videoCover;

    /**
     * 视频名称
     */
    private String videoName;

    @Override
    public String toString() {
        return "用户ID:" + (userId == null ? "空" : userId) + "，视频ID:" + (videoId == null ? "空" : videoId) + "，文件索引:" + (fileIndex == null ? "空" : fileIndex) + "，最后更新时间:" + (lastUpdateTime == null ?
                "空" : DateUtil.format(
                lastUpdateTime,
                DateTimePatternEnum.YYYY_MM_DD_HH_MM_SS.getPattern()));
    }
}
